var Base = gg.module('view.jq.Base');

var View = Base.extend({
    createNode: function(attrs) {
        attrs = attrs || {};
        var dom = $('<input>');
        var self = this;
        var handler = _.debounce(function() {
            self.updateModel('value');
        }, 500);
        dom.bind('input', handler);
        return dom;
    },
    destroyNode: function() {
        this.node.remove();
    }
});

//视图属性
var attr = {};
attr.value = {
    defaultValue: '',
    label: '值',
    type: 'datatype.String',
    setter: function(v) {
        this.node.val(v);
    },
    getter: function() {
        return this.node.val();
    }
};

View.metadata = _.extend({}, Base.metadata, attr);

module.exports = View;